Page objects
-
Base page object protocol. Defines basic properties and methods required by all page objects.
Example:
See moreclass MainPage: BaseAppPageProtocol { var view: XCUIElement public init(in view: XCUIElement) { self.view = view } }
Declaration
Swift
public protocol BaseAppPageProtocol
-
Base implementation of the
BaseAppPageProtocol
. All page objects can inherit from this class.Example:
See moreclass MainPage: BaseAppPage { var tableView: XCUIElement { return view.tables[Locators.tableView] } } private extension MainPage { enum Locators: String, Locator { case tableView } }
Declaration
Swift
open class BaseAppPage : BaseAppPageProtocol
-
Page object protocol describing behaviour of modally presented view.
Default implementation use
close
asaccessibilityIdentifier
.Example:
class AboutTheAppPage: BaseAppPage, ModalPage {} let aboutTheAppPage = AboutTheAppPage(in: containerView) aboutTheAppPage.closeModalPage()
Requires
It is required to useclose
asaccessibilityIdentifier
in custom close button in the application to work with default implementation of this protocol.Declaration
Swift
public protocol ModalPage : BaseAppPageProtocol
-
Page object protocol describing behaviour of pushed.
Default implementation use
back
asaccessibilityIdentifier
.Example:
class AboutTheAppPage: BaseAppPage, PushedPage {} let aboutTheAppPage = AboutTheAppPage(in: containerView) aboutTheAppPage.goBack()
Requires
It is required to useback
asaccessibilityIdentifier
in custom back button in the application to work with default implementation of this protocol.Declaration
Swift
public protocol PushedPage : BaseAppPageProtocol
-
Page object representing HealthKit permission view.
It can only allow to tap on buttons:
- Allow
- Deny
- Turn on all permissions
- Turn off all permissions
Example:
See morelet healthPermissionPage = HealthPermissionPage(in: self.app) healthPermissionPage.turnOnAllElement.tap() healthPermissionPage.allowElement.tap()